package de.rj.urwalking.data;

import java.util.Collection;
import java.util.HashMap;

import com.threed.jpct.Object3D;

/**
 * A subclass of JPCT's {@link Object3D} that adds the ability to give a user defined name.
 * 
 * @author rjj
 * 
 */
public abstract class SalientObject extends Object3D {

	public static final int BUILDING = 0;
	public static final int POI = 1;
	public static final int NEW = 2;
	public static final int PIN = 3;

	private static final long serialVersionUID = 1L;

	protected HashMap<Integer, String> previousNames = new HashMap<Integer, String>();
	private String userDefinedName;

	public SalientObject(Object3D object3d) {
		super(object3d);
	}

	public String getUserDefinedName() {
		return userDefinedName;
	}

	/**
	 * Checks if there is already a name set.
	 * 
	 * @return true if there is a name, false if not
	 */
	public boolean hasUserDefinedName() {
		return userDefinedName != null;
	}

	public void setUserDefinedName(String name) {
		userDefinedName = name;
	}

	public void addName(String name, int id) {
		previousNames.put(id, name);
	}

	public Collection<String> getAllNames() {
		return previousNames.values();
	}

	public boolean wasPreviouslyALandmark() {
		return !previousNames.isEmpty();
	}

	public abstract void dontShowAsLandmark();

}
